package com.wfs.utils;

import java.util.ArrayList;
import java.util.List;
import java.util.function.BiConsumer;

/**
 * @author: wfs
 * @Date: 2021/1/13 10:43
 * @Description:
 */
public class BasicTest {
    public static void main(String[] args) {
        List<User> users=new ArrayList<>();
        users.add(new User(1L,""));
        users.add(new User(2L,""));
        users.add(new User(-1L,"www"));
        BasicCacheHelperNew basicCacheHelperNew=new BasicCacheHelperNew();
        basicCacheHelperNew.stream(users).userIdToName(User::getUserId,User::setName).translate();
        System.out.println(users);
        User user=new User(2L,"");
        BiConsumer<User,String>  biConsumer=new BiConsumer<User, String>() {
            @Override
            public void accept(User user, String s) {
                user.setName(s);
            }
        };

        biConsumer.accept(user,"213");
        System.out.println(user);
    }


}

 class User{
    Long  userId;
    String name;

    public User(Long userId, String name) {
        this.userId = userId;
        this.name = name;
    }

    public Long getUserId() {
        return userId;
    }

    public void setUserId(Long userId) {
        this.userId = userId;
    }

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }
}